import pymysql

def insertData(sql):
    try:
        db = pymysql.connect(host='106.52.100.112', port=33306,user='cp', passwd='mysql', database='cp')
        cursor = db.cursor()
        cursor.execute(sql)
        db.commit()
    except Exception as e:
        print('保存数据异常',e)
    finally:
        cursor.close()
        db.close()
        print('保存数据执行完成')

